<template>
  <el-card
    style="width: 1400px; margin: 0 auto; min-height: 80vh"
    v-loading="loading"
  >
    <template #header>
      <div class="header">
        <el-icon class="icon" size="20" @click="goBack"><ArrowLeft /></el-icon>
        <span>查看</span>
      </div>
    </template>
    <el-row :gutter="20" style="padding-top: 10px">
      <el-col :span="24">
        <div class="info">
          <div class="info-label">问题风险类型</div>
          <div class="info-input">{{ detailInfo.types || '' }}</div>
        </div>
      </el-col>
      <el-col :span="24">
        <div class="info">
          <div class="info-label">问题描述</div>
          <div class="info-input">{{ detailInfo.describes || '' }}</div>
        </div>
      </el-col>
      <el-col :span="24">
        <div class="info">
          <div class="info-label">整改要求</div>
          <div class="info-input">{{ detailInfo.requirement || '' }}</div>
        </div>
      </el-col>
      <el-col :span="24">
        <div class="info">
          <div class="info-label">佐证材料</div>
          <div class="info-input">
            <div style="width: 70%">
              <PreviewFile :tableData="detailInfo.files" />
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
  </el-card>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { problemDetail, soptCheckDetail } from '@/api/spotCheck/spotCheck'
import { useRoute, useRouter } from 'vue-router'
import { ArrowLeft } from '@element-plus/icons-vue'
import { dateFormat } from '@/utils'
import PreviewFile from '@/views/spotCheck/components/previewFile/previewFile.vue'

const router = useRouter()

const route = useRoute()
const detailInfo = ref('')
const loading = ref(false)
onMounted(() => {
  loading.value = true
  problemDetail({ sorgProblemId: route.query.id, status: route.query.status })
    .then((res) => {
      detailInfo.value = res.data
    })
    .finally(() => {
      loading.value = false
    })
})

//返回
const goBack = () => {
  router.go(-1)
}
</script>

<style scoped lang="scss">
.info {
  display: flex;
  margin-bottom: 30px;
  .info-label {
    width: 108px;
    font-family: Source Han Sans SC, Source Han Sans SC;
    font-weight: 300;
    font-size: 18px;
    color: #666666;
    margin-right: 20px;
    display: inline-flex;
    justify-content: flex-end;
    align-items: center;
    height: 30px;
  }
  .info-input {
    flex: 1;
    font-family: Source Han Sans SC, Source Han Sans SC;
    font-weight: 400;
    font-size: 18px;
    color: #333333;
    line-height: 30px;
    min-width: 0;
  }
}

.upload {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.uploadListTable {
  border: 1px solid #e9e9e9;
}

:deep(.uploadListTable th) {
  background: #f5f6f8;
  font-weight: 300;
  font-size: 16px;
  color: #333333;
  height: 38px;
}
.header {
  display: flex;
  align-items: center;
  .icon {
    margin-right: 16px;
    cursor: pointer;
  }
  span {
    font-family: Source Han Sans SC, Source Han Sans SC;
    font-weight: 500;
    font-size: 20px;
    color: #333333;
  }
}
</style>
